// v-model mixin
export default {
  props: {
    value: {
      type: [String, Number, Object, Array],
      default: () => undefined
    }
  },
  data() {
    return {
      form: this.value
    };
  },
  watch: {
    value(newVal) {
      this.form = newVal;
      console.log(this.form)
    },
    form(val) {
      console.log(val)
      this.$emit("input", val);
    }
  },
  methods: {
    validate(...args) {
      return this.$refs.form.validate(...args);
    },
    clearValidate(...args) {
      return this.$refs.form.clearValidate(...args);
    }
  }
};
